import React from 'react';
import ReactDOM from 'react-dom';
import { HashRouter as Router, Route, Switch, Redirect } from 'react-router-dom';
import MyMusic from '@/components/MyMusic/MyMusic';
import Player from '@/components/Base/Player';
import PlayerList from '@/components/Base/PlayList';
import HallIndex from '@/components/MusicHall/index/Index';
import HallSinger from '@/components/MusicHall/singer/Singer';
import HallAlbum from '@/components/MusicHall/album/Album';
import HallRankingList from '@/components/MusicHall/rankingList/RankingList';
import HallSonglist from '@/components/MusicHall/songList/SongList';
import HallBroadcasting from '@/components/MusicHall/broadcasting/Broadcasting';
import HallMV from '@/components/MusicHall/MV/MV';
import Neidi from '@/components/MusicHall/MV/Neidi';
import Allmv from '@/components/MusicHall/MV/Allmv';
import HallNumAlbum from '@/components/MusicHall/numAlbum/NumAlbum';
import HallTicket from '@/components/MusicHall/ticket/Ticket';
import Seek from '@/components/Base/seek/Seek';
import User from '@/components/User/user';
import VIP from '@/components/VIP/VIP';
import Apply from '@/components/Apply/Apply';
import MVshow from '@/components/MusicHall/MV/MVshow/MVshow';


import * as serviceWorker from './serviceWorker';
import './main.scss';
import 'antd/dist/antd.css';
// import './api';

ReactDOM.render(
  <Router>
    <Switch>
      <Route path = "/mymusic" component = { MyMusic } />
      <Route path = "/seek/:id" component = { Seek } />
      <Route path = "/player/:id" component = { Player } />
      <Route path = "/playerlist/:id" component = { PlayerList } />
      <Route path = "/musichall/index" component = { HallIndex } />
      <Route path = "/musichall/singer" component = { HallSinger } />
      <Route path = "/musichall/album" component = { HallAlbum } />
      <Route path = "/musichall/rankinglist" component = { HallRankingList } />
      <Route path = "/musichall/songlist" component = { HallSonglist } />
      <Route path = "/musichall/broadcasting" component = { HallBroadcasting } />
      <Route path = "/musichall/mv" component = { HallMV } />
      <Route path = "musichall/mv/allmv" component = { Allmv } />
      <Route path = "/neidi" component = { Neidi } />
      <Route path = "/musichall/numalbum" component = { HallNumAlbum } />
      <Route path = "/musichall/ticket" component = { HallTicket } />
      <Route path = "/user" component = { User } />
      <Route path = "/VIP" component = { VIP } />
      <Route path = "/apply" component = { Apply } />
      <Route path = "/MVshow/:id" component = { MVshow } />
      <Route path="*" render={() => <Redirect to="/musichall/index"/> }/>
    </Switch>
  </Router>
, document.getElementById('root'));

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
process.env.NODE_ENV === 'production' ? serviceWorker.register() : serviceWorker.unregister();
